package com.ruoyi.web.controller.retirement;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.retirement.domain.RetirementAgreement;
import com.ruoyi.retirement.service.IRetirementAgreementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 界面与协议Controller
 * 
 * @author 曹旭
 * @date 2025-09-08
 */
@RestController
@RequestMapping("/retirement/retirementAgreement")
public class RetirementAgreementController extends BaseController
{
    @Autowired
    private IRetirementAgreementService retirementAgreementService;

    /**
     * 查询界面与协议列表
     */
    @PreAuthorize("@ss.hasPermi('retirement:retirementAgreement:list')")
    @GetMapping("/list")
    public TableDataInfo list(RetirementAgreement retirementAgreement)
    {
        startPage();
        List<RetirementAgreement> list = retirementAgreementService.selectRetirementAgreementList(retirementAgreement);
        return getDataTable(list);
    }

    /**
     * 获取界面与协议详细信息
     */
    @PreAuthorize("@ss.hasPermi('retirement:retirementAgreement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(retirementAgreementService.selectRetirementAgreementById(id));
    }

    /**
     * 修改界面与协议
     */
    @PreAuthorize("@ss.hasPermi('retirement:retirementAgreement:edit')")
    @Log(title = "界面与协议", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RetirementAgreement retirementAgreement)
    {
        return toAjax(retirementAgreementService.updateRetirementAgreement(retirementAgreement));
    }


    /**
     * 修改界面与协议
     */
    @PreAuthorize("@ss.hasPermi('retirement:retirementAgreement:edit')")
    @Log(title = "界面与协议", businessType = BusinessType.UPDATE)
    @RequestMapping("/changeIsGrayOut")
    public AjaxResult changeIsGrayOut(@RequestBody RetirementAgreement retirementAgreement)
    {
        return toAjax(retirementAgreementService.updateRetirementAgreement(retirementAgreement));
    }




}
